﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;

namespace DIST.LR.ZHJG.Controls.Chart
{
    public class ucStackedBarViewModel
    {
        #region StactBarData尝试没成功
        private IList<StactBarData> _sbardata;
        public IList<StactBarData> SBarCollectionData
        {
            get
            {
                //if (this._sbardata == null)
                //{
                //    this._sbardata = this.FillStackBarChartData(this.SeriesCount, this.ItemsCount);
                //}

                return this._sbardata;
            }
        }

        public StactBarData SBarData
        {
            get
            {
                return this.SBarCollectionData[0];
            }
        }
        #endregion

        #region stackbar 数据绑定
        private IList<IEnumerable<double>> _data;
        private int _itemsCount;
        private int _seriesCount;

        public IList<IEnumerable<double>> CollectionData
        {
            get
            {
                if (this._data == null)
                {
                    this._data = this.FillSampleChartData(this.SeriesCount, this.ItemsCount);
                }

                return this._data;
            }
        }

        public IEnumerable<double> Data
        {
            get
            {
                return this.CollectionData[0];
            }
        }

        public int ItemsCount
        {
            get
            {
                return _itemsCount;
            }
            set
            {
                _itemsCount = value;
            }
        }

        public int SeriesCount
        {
            get
            {
                return _seriesCount;
            }
            set
            {
                _seriesCount = value;
            }
        }

        protected virtual IList<IEnumerable<double>> FillSampleChartData(int seriesCount, int numbOfItems)
        {
            List<IEnumerable<double>> itemsSource = new List<IEnumerable<double>>();

            //for (int i = 0; i < seriesCount; i++)
            //{
            //    itemsSource.Add(SeriesExtensions.GetUserData(numbOfItems, i));
            //}

            return itemsSource;
        }
        #endregion
    }

    public class StactBarData 
    {
        private string _country;
        public string Country
        {
            get
            {
                return this._country;
            }
            set
            {
                this._country = value;
            }
        }

        private IEnumerable<double> _share;
        public IEnumerable<double> Share
        {
            get
            {
                return this._share;
            }
            set
            {
                this._share = value;
            }
        }

        public StactBarData(string country, IEnumerable<double> share)
        {
            this._share = share;
            this._country = country;
        }
    }
}
